function [centers, counter] = fill_remaining_space(...
    centers, counter, occupied_map, available_map, X, Y, EMSD, step)
while true
    % Find available pixels
    [available_pixels_coords, available_length] = get_available_pixels(available_map);
    if available_length < 1
        break;
    end
    
    % Try to generate speckles around the first available pixel
    flag = false;  % Flag indicating successful speckle generation
    for i = 0:step:0.9
        for j = 0:step:0.9
            new_center = [available_pixels_coords(1, 2) - i, ...
                available_pixels_coords(1, 1) - j];
            
            if ~is_overlapping(new_center, occupied_map, X, Y, EMSD)
                flag = true;
                counter = counter + 1;
                centers(counter, :) = new_center;  % Add new center
                [occupied_map, available_map] = update_maps(...
                    new_center, occupied_map, available_map, X, Y, EMSD);
                break;
            end
        end
        if flag
            break;
        end
    end
    
    % If speckle generation fails, mark this point as unavailable
    if ~flag
        available_map(available_pixels_coords(1, 1), available_pixels_coords(1, 2)) = false;
    end
end
end
